[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
strpbrk() Scan String for Character from Character Set
#include <string.h> Required for declarations only
char *strpbrk(string1,charset);
const char *string1; Source string
const char *charset; Character set
strpbrk() scans 'string1' for the first occurrence of any of the
characters from 'charset'. The terminating null character ('\0') is
not included in the search.
Returns: A pointer to the first occurrence of any of the
characters in 'charset'. If none of the characters
in 'charset' occur in 'string1' a NULL pointer is
returned.
-------------------------------- Example ---------------------------------
The following statements scan 'string' for a vowel. If one is found,
a message, along with the vowel, is printed.
#include <string.h>
#include <stdio.h>
char string[20] = "straight";
char charset[6] = "aeiou";
char *rslt;
main()
{
if ((rslt = strpbrk(string,charset)) != NULL)
printf("vowel found: %c \n",*rslt);
}
See Also:
strcspn()
strchr()
strrchr()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson